package com.ruoyi.btlfbreed.mapper;

import java.util.List;

import com.ruoyi.btlfbreed.domain.MyTbChickenGrowData;
import com.ruoyi.btlfbreed.domain.MyTbChickenHatchRecordsData;
import com.ruoyi.btlfbreed.domain.TbChickenHatchRecords;
import com.ruoyi.btlfbreed.domain.TbChickens;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;

/**
 * 肉鸡孵化记录Mapper接口
 * 
 * @author cpdeman
 * @date 2024-05-05
 */
public interface TbChickenHatchRecordsMapper 
{
    /**
     * 查询肉鸡孵化记录
     * 
     * @param id 肉鸡孵化记录主键
     * @return 肉鸡孵化记录
     */
    public TbChickenHatchRecords selectTbChickenHatchRecordsById(Long id);

    /**
     * 查询肉鸡孵化记录列表
     * 
     * @param tbChickenHatchRecords 肉鸡孵化记录
     * @return 肉鸡孵化记录集合
     */
    public List<TbChickenHatchRecords> selectTbChickenHatchRecordsList(TbChickenHatchRecords tbChickenHatchRecords);

    /**
     * 新增肉鸡孵化记录
     * 
     * @param tbChickenHatchRecords 肉鸡孵化记录
     * @return 结果
     */
    public int insertTbChickenHatchRecords(TbChickenHatchRecords tbChickenHatchRecords);

    /**
     * 修改肉鸡孵化记录
     * 
     * @param tbChickenHatchRecords 肉鸡孵化记录
     * @return 结果
     */
    public int updateTbChickenHatchRecords(TbChickenHatchRecords tbChickenHatchRecords);

    /**
     * 删除肉鸡孵化记录
     * 
     * @param id 肉鸡孵化记录主键
     * @return 结果
     */
    public int deleteTbChickenHatchRecordsById(Long id);

    /**
     * 批量删除肉鸡孵化记录
     * 
     * @param ids 需要删除的数据主键集合
     * @return 结果
     */
    public int deleteTbChickenHatchRecordsByIds(Long[] ids);

    /**
     * 批量删除肉鸡
     * 
     * @param ids 需要删除的数据主键集合
     * @return 结果
     */
    public int deleteTbChickensByParentIds(Long[] ids);
    
    /**
     * 批量新增肉鸡
     * 
     * @param tbChickensList 肉鸡列表
     * @return 结果
     */
    public int batchTbChickens(List<TbChickens> tbChickensList);
    

    /**
     * 通过肉鸡孵化记录主键删除肉鸡信息
     * 
     * @param id 肉鸡孵化记录ID
     * @return 结果
     */
    public int deleteTbChickensByParentId(Long id);


    @Select("<script>SELECT year(hatch_start_time) year,avg(hatch_rate) hatchRate,avg(mortality_rate) mortalityRate  FROM `tb_chicken_hatch_records` \n" +
        "group by year(hatch_start_time) " +
        "order by year(hatch_start_time) " +
        "</script>")
    public List<MyTbChickenHatchRecordsData> getYearHatchData();

}
